/**
 * 
 */
package cn.netjava.softkid.chapter09;

import java.io.File;

/**
 * @author Administrator
 *
 */
public class FindFileUseMutiThreadTest {

	/**
	 * @param args
	 */
	public static void main(String args[])
	{
		java.util.List<FindFileUseMutiThread> allThread= new java.util.ArrayList<FindFileUseMutiThread>();
		File[] roots = File.listRoots();
		for(int i=0;i<roots.length;i++)
		{
			FindFileUseMutiThread th = new FindFileUseMutiThread(roots[i].getAbsolutePath(),".mp3");
//			try {
				System.out.println("start search:"+roots[i].getAbsolutePath());
				th.start();
				allThread.add(th);
//				th[i].join();
//			} catch (InterruptedException e) {
//				e.printStackTrace();
//			}
		}
		System.out.println(allThread.size()+" threads had started! ");
		
		MonitorThread mt = new MonitorThread(allThread);
		Thread t = new Thread(mt);
		t.start();
		System.out.println("Monitor thread had started!");
	}

}
